API Documentation
Public Member Functions | List of all members
nkMaths::IVector Class Reference

A 4-component vector class, with integers. More...

Inheritance diagram for nkMaths::IVector:

Public Member Functions

 IVector ()
 
 IVector (int x, int y)
 
 IVector (int x, int y, int z)
 
 IVector (int x, int y, int z, int w)
 
 IVector (const Vector &other)
 
 IVector (const IVector &other)
 
 IVector (const DirectX::XMVECTOR &value)
 
 IVector (const DirectX::XMVECTORI32 &value)
 
 ~IVector ()
 
int getX () const
 
int getY () const
 
int getZ () const
 
int getW () const
 
DirectX::XMVECTORI32 getValues () const
 
void setX (int value)
 
void setY (int value)
 
void setZ (int value)
 
void setW (int value)
 
void addX (int value)
 
void addY (int value)
 
void addZ (int value)
 
void addW (int value)
 
void multX (int value)
 
void multY (int value)
 
void multZ (int value)
 
void multW (int value)
 
float getLength () const
 
int getLengthSquared () const
 
int getDistanceSquared (const IVector &other) const
 
float getDistance (const IVector &other) const
 
void fromString (const char *str)
 
IVectoroperator= (const IVector &other)
 
IVectoroperator= (const Vector &other)
 
IVector operator+ (const IVector &other) const
 
void operator+= (const IVector &other)
 
IVector operator- (const IVector &other) const
 
void operator-= (const IVector &other)
 
IVector operator* (const IVector &other) const
 
void operator*= (const IVector &other)
 
IVector operator* (int coeff) const
 
void operator*= (int coeff)
 
IVector operator/ (const IVector &other) const
 
void operator/= (const IVector &other)
 
IVector operator/ (int coeff) const
 
void operator/= (int coeff)
 
bool operator== (const IVector &other) const
 
bool operator< (const IVector &other) const
 
bool operator<= (const IVector &other) const
 
bool operator> (const IVector &other) const
 
bool operator>= (const IVector &other) const
 

Detailed Description

A 4-component vector class, with integers.

Constructor & Destructor Documentation

◆ IVector() [1/8]

nkMaths::IVector::IVector ( )

Default constructor.

◆ IVector() [2/8]

nkMaths::IVector::IVector ( int  x,
int  y 
)

2D constructor.

Parameters
xThe x component to assign.
yThe y component to assign.

◆ IVector() [3/8]

nkMaths::IVector::IVector ( int  x,
int  y,
int  z 
)

3D constructor.

Parameters
xThe x component to assign.
yThe y component to assign.
zThe z component to assign.

◆ IVector() [4/8]

nkMaths::IVector::IVector ( int  x,
int  y,
int  z,
int  w 
)

4D constructor.

Parameters
xThe x component to assign.
yThe y component to assign.
zThe z component to assign.
wThe w component to assign.

◆ IVector() [5/8]

nkMaths::IVector::IVector ( const Vector other)

Copy constructor.

Parameters
otherThe vector to copy from.

◆ IVector() [6/8]

nkMaths::IVector::IVector ( const IVector other)

Copy constructor.

Parameters
otherThe vector to copy from.

◆ IVector() [7/8]

nkMaths::IVector::IVector ( const DirectX::XMVECTOR &  value)

Fill constructor.

Parameters
valueThe XM values.

◆ IVector() [8/8]

nkMaths::IVector::IVector ( const DirectX::XMVECTORI32 &  value)

Fill constructor.

Parameters
valueThe XM values.

◆ ~IVector()

nkMaths::IVector::~IVector ( )

Destructor.

Member Function Documentation

◆ getX()

int nkMaths::IVector::getX ( ) const
Returns
The x component.

◆ getY()

int nkMaths::IVector::getY ( ) const
Returns
The y component.

◆ getZ()

int nkMaths::IVector::getZ ( ) const
Returns
The z component.

◆ getW()

int nkMaths::IVector::getW ( ) const
Returns
The w component.

◆ getValues()

DirectX::XMVECTORI32 nkMaths::IVector::getValues ( ) const
Returns
The values compressed in the DirectXMath structure.
Remarks
Avoid using this function as this will most likely be dropped when the Maths component is created.

◆ setX()

void nkMaths::IVector::setX ( int  value)

Sets the x component.

Parameters
valueThe value to set.

◆ setY()

void nkMaths::IVector::setY ( int  value)

Sets the y component.

Parameters
valueThe value to set.

◆ setZ()

void nkMaths::IVector::setZ ( int  value)

Sets the z component.

Parameters
valueThe value to set.

◆ setW()

void nkMaths::IVector::setW ( int  value)

Sets the w component.

Parameters
valueThe value to set.

◆ addX()

void nkMaths::IVector::addX ( int  value)

Adds to the x component.

Parameters
valueThe value to add.

◆ addY()

void nkMaths::IVector::addY ( int  value)

Adds to the y component.

Parameters
valueThe value to add.

◆ addZ()

void nkMaths::IVector::addZ ( int  value)

Adds to the z component.

Parameters
valueThe value to add.

◆ addW()

void nkMaths::IVector::addW ( int  value)

Adds to the w component.

Parameters
valueThe value to add.

◆ multX()

void nkMaths::IVector::multX ( int  value)

Multiply the x component.

Parameters
valueThe value to multiply.

◆ multY()

void nkMaths::IVector::multY ( int  value)

Multiply the y component.

Parameters
valueThe value to multiply.

◆ multZ()

void nkMaths::IVector::multZ ( int  value)

Multiply the z component.

Parameters
valueThe value to multiply.

◆ multW()

void nkMaths::IVector::multW ( int  value)

Multiply the w component.

Parameters
valueThe value to multiply.

◆ getLength()

float nkMaths::IVector::getLength ( ) const
Returns
The length of the vector.

◆ getLengthSquared()

int nkMaths::IVector::getLengthSquared ( ) const
Returns
The length of the vector, quared. For simple comparisons, if possible, prefer this function as it is more performant.

◆ getDistanceSquared()

int nkMaths::IVector::getDistanceSquared ( const IVector other) const
Parameters
otherThe vector to check the distance with.
Returns
The distance between both vectors, squared. Prefer to use this function when possible as it is more performant.

◆ getDistance()

float nkMaths::IVector::getDistance ( const IVector other) const
Parameters
otherThe vector to check the distance with.
Returns
The distance between both vectors.

◆ fromString()

void nkMaths::IVector::fromString ( const char *  str)

Parse components from a string. Format is "x,y,z,w".

Parameters
strThe string to parse.

◆ operator=() [1/2]

IVector& nkMaths::IVector::operator= ( const IVector other)

Assignment operator.

Parameters
otherThe vector to overwrite from.
Returns
The calling vector, updated.

◆ operator=() [2/2]

IVector& nkMaths::IVector::operator= ( const Vector other)

Assignment operator.

Parameters
otherThe vector to overwrite from.
Returns
The calling vector, updated.

◆ operator+()

IVector nkMaths::IVector::operator+ ( const IVector other) const

Addition operator.

Parameters
otherThe vector to operate with.
Returns
A result vector, after operation application.

◆ operator+=()

void nkMaths::IVector::operator+= ( const IVector other)

Addition and assignment operator.

Parameters
otherThe vector to operate with.

◆ operator-()

IVector nkMaths::IVector::operator- ( const IVector other) const

Subtraction operator.

Parameters
otherThe vector to operate with.
Returns
A result vector, after operation application.

◆ operator-=()

void nkMaths::IVector::operator-= ( const IVector other)

Subtraction and assignment operator.

Parameters
otherThe vector to operate with.

◆ operator*() [1/2]

IVector nkMaths::IVector::operator* ( const IVector other) const

Multiplication operator.

Parameters
otherThe vector to operate with.
Returns
A result vector, after operation application.

◆ operator*=() [1/2]

void nkMaths::IVector::operator*= ( const IVector other)

Multiplication and assignment operator.

Parameters
otherThe vector to operate with.

◆ operator*() [2/2]

IVector nkMaths::IVector::operator* ( int  coeff) const

Multiplication operator.

Parameters
coeffThe scalar to operate with.
Returns
A result vector, after operation application on all components.

◆ operator*=() [2/2]

void nkMaths::IVector::operator*= ( int  coeff)

Multiplication and assignment operator.

Parameters
coeffThe scalar to operate with.

◆ operator/() [1/2]

IVector nkMaths::IVector::operator/ ( const IVector other) const

Division operator.

Parameters
otherThe vector to operate with.
Returns
A result vector, after operation application.

◆ operator/=() [1/2]

void nkMaths::IVector::operator/= ( const IVector other)

Division and assignment operator.

Parameters
otherThe vector to operate with.

◆ operator/() [2/2]

IVector nkMaths::IVector::operator/ ( int  coeff) const

Division operator.

Parameters
coeffThe scalar to operate with.
Returns
A result vector, after operation application on all components.

◆ operator/=() [2/2]

void nkMaths::IVector::operator/= ( int  coeff)

Division and assignment operator.

Parameters
coeffThe scalar to operate with.

◆ operator==()

bool nkMaths::IVector::operator== ( const IVector other) const

Equality operator.

Parameters
otherThe vector to check against.
Returns
If the vectors are equal (true) or not (false).

◆ operator<()

bool nkMaths::IVector::operator< ( const IVector other) const

Less than operator.

Parameters
otherThe vector to check against.
Returns
If the calling vector is smaller (true) or not (false).

◆ operator<=()

bool nkMaths::IVector::operator<= ( const IVector other) const

Less than or equal operator.

Parameters
otherThe vector to check against.
Returns
If the calling vector is smaller, equal (true) or not (false).

◆ operator>()

bool nkMaths::IVector::operator> ( const IVector other) const

Greater than operator.

Parameters
otherThe vector to check against.
Returns
If the calling vector is greater (true) or not (false).

◆ operator>=()

bool nkMaths::IVector::operator>= ( const IVector other) const

Greater than or equal operator.

Parameters
otherThe vector to check against.
Returns
If the calling vector is greater, equal (true) or not (false).

The documentation for this class was generated from the following file: